package org.szpshang.system.resource.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.szpshang.bean.JsonBean;
import org.szpshang.bean.JsonDataBean;
import org.szpshang.system.resource.service.ResourceService;

@Controller
@RequestMapping("/resource")
public class ResourceController {

	@Autowired
	private ResourceService resourceService;

	@RequestMapping(value = "/root", method = RequestMethod.POST)
	public @ResponseBody JsonDataBean getTop() throws Exception {
		return new JsonDataBean(true, this.resourceService.getRootResource());
	}

	@RequestMapping(value = "/root/{id}", method = RequestMethod.POST)
	public @ResponseBody JsonDataBean getTop(@PathVariable String id) {
		return new JsonDataBean(true, this.resourceService.getRootResource(id));
	}
	
	@RequestMapping(value = "/changePassword", method = RequestMethod.POST)
	public @ResponseBody JsonBean changePassword() {
		//成功以后退出
		return new JsonBean(true);
	}
	
}
